﻿<?php
	
	session_start();
	include 'funcoes.php';
	include '../conexao.php';
	
	if(isset($_POST['id_prof'])){
		$id_prof  = $_POST['id_prof'];
		$id_aluno = $_SESSION['id_aluno'];
		$tabela   = $_SESSION['turma'];
		
		$q1  = $_POST['q1'];
		$q2  = $_POST['q2'];
		$q3  = $_POST['q3'];
		$q4  = $_POST['q4'];
		$q5  = $_POST['q5'];
		$q6  = $_POST['q6'];
		$q7  = $_POST['q7'];
		$q8  = $_POST['q8'];
		$q9  = $_POST['q9'];
		$q10 = $_POST['q10'];
		$q11 = $_POST['q11'];
		$q12 = $_POST['q12'];
		$q13 = $_POST['q13'];
		$q14 = $_POST['q14'];
		$q15 = $_POST['q15'];
		$q16 = $_POST['q16'];
		$q17 = $_POST['q17'];
		$q18 = $_POST['q18'];
		$q19 = $_POST['q19'];
		$q20 = $_POST['q20'];
		$q21 = $_POST['q21'];
		$q22 = $_POST['q22'];
		$q23 = $_POST['q23'];
		$q24 = $_POST['q24'];
		$q25 = $_POST['q25'];
		
		$insert = "INSERT INTO avaliacao_geral(turma, id_prof, id_aluno, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25) VALUES('{$tabela}', {$id_prof}, {$id_aluno}, {$q1}, {$q2}, {$q3}, {$q4}, {$q5}, {$q6}, {$q7}, {$q8}, {$q9}, {$q10}, {$q11}, {$q12}, {$q13}, {$q14}, {$q15}, {$q16}, {$q17}, {$q18}, {$q19}, {$q20}, {$q21}, {$q22}, {$q23}, {$q24}, {$q25})";
		
		
		$insertc = "INSERT INTO controle(id_aluno,id_prof) VALUES({$id_aluno},{$id_prof})";
		if(mysql_query($insert) or die (mysql_error())){
			if(mysql_query($insertc) or die (mysql_error())){
				echo "<script>alert('Professor avaliado com sucesso');location='avaliacao.php'</script>";
			}
		}
		
	}
?>